#Set Directory Below
setwd("...")
plot<-read.csv("coefplot.csv")
plot1<-plot[1:6,]
setwd("C:/Users/Kogan.18.ASC/Dropbox/Potholes/APSA")
pdf("fig1.pdf", width=6, height=5*1.33)
par(mar=c(10,6,6,3), lheight = .8)#set margins for regression plot

plot(0,0, type = "p", col="black", axes = F, xlab = "", ylab = "", pch = 19, cex = 0.6, #plot model 1 coefs using black points (pch = 19, default = black), adding the "adjust amount" to the y.axis indicator to move points up
    xlim = c(-0.5,0.3), ylim=c(0.7,3.3), ann=FALSE)
   mtext(side = 1, text = "Effect of Additional Pothole on Incumbent Vote Share", line = 4)
axis(1,at = seq(-0.5,0.3, by = 0.1), label = seq(-0.5,0.3, by = 0.1), mgp = c(2,2,1), cex.axis = 0.9)#add x-axis and labels; "pretty" creates a sequence of  equally spaced nice values that cover the range of the values in 'x'-- in this case, integers
axis(2, at = 1:3, tick=FALSE, label = c("Spatial Error","Spatial Lag", "OLS"), las = 1, cex.axis =1)#add y-axis and labels; las = 1 makes labels perpendicular to y-axis
axis(3,at = seq(-0.5,0.3, by = 0.1), label = seq(-0.5,0.3, by = 0.1), mgp = c(2,2,1), cex.axis =0.9)#add x-axis and labels; "pretty" creates a sequence of  equally spaced nice values that cover the range of the values in 'x'-- in this case, integers
abline(v=0, lwd = .25, col = "dark grey", lty="dashed")
#abline(h = y.axis, lty = 2, lwd = .25, col = "light grey")#draw light dotted line at each variable for dotplot effect

segments(x0=plot1$Coef-(1.96*plot1$SE),y0=plot1$Row+plot1$Adjust, x1=plot1$Coef+(1.96*plot1$SE),y1=plot1$Row+plot1$Adjust, lwd =  1.3)#draw lines connecting 95% confidence intervals
points(y=plot1$Row+plot1$Adjust, x=plot1$Coef, pch=plot1$pch, xpd=TRUE, cex=1.2, col="black", bg="white")
legend(-0.35, -0.6, legend=c("Mayor","City Council"), lty=c("solid","solid"),lwd=c(1.3,1.3),col=c("black","black"), pt.cex=1.2, pch=c(19,17),horiz=TRUE, box.lty=0, box.lwd=1, xpd=TRUE)
dev.off()

plot1<-plot[7:19,]

pdf("fig2.pdf", width=6, height=5*1.33)
par(mar=c(10,6,6,3), lheight = .8)#set margins for regression plot

plot(0,0, type = "p", col="black", axes = F, xlab = "", ylab = "", pch = 19, cex = 0.6, #plot model 1 coefs using black points (pch = 19, default = black), adding the "adjust amount" to the y.axis indicator to move points up
    xlim = c(-1,1), ylim=c(0.7,3.3), ann=FALSE)
   mtext(side = 1, text = "Effect of Additional Pothole on Incumbent Vote Share", line = 4)
axis(1,at = seq(-1,1, by = 0.2), label = seq(-1,1, by = 0.2), mgp = c(2,2,1), cex.axis = 0.75)#add x-axis and labels; "pretty" creates a sequence of  equally spaced nice values that cover the range of the values in 'x'-- in this case, integers
axis(2, at = 1:3, tick=FALSE, label = c("Spatial Error","Spatial Lag", "OLS"), las = 1, cex.axis =1)#add y-axis and labels; las = 1 makes labels perpendicular to y-axis
axis(3,at = seq(-1,1, by = 0.2), label = seq(-1,1, by = 0.2), mgp = c(2,2,1), cex.axis =0.75)#add x-axis and labels; "pretty" creates a sequence of  equally spaced nice values that cover the range of the values in 'x'-- in this case, integers
abline(v=0, lwd = .25, col = "dark grey", lty="dashed")
#abline(h = y.axis, lty = 2, lwd = .25, col = "light grey")#draw light dotted line at each variable for dotplot effect

segments(x0=plot1$Coef-(1.96*plot1$SE),y0=plot1$Row+plot1$Adjust, x1=plot1$Coef+(1.96*plot1$SE),y1=plot1$Row+plot1$Adjust, lwd =  1.3)#draw lines connecting 95% confidence intervals
points(y=plot1$Row+plot1$Adjust, x=plot1$Coef, pch=plot1$pch, xpd=TRUE, cex=1.2, col="black", bg="white")
legend(-1.1, -0.45, legend=c("Mayor","Mayor (Placebo)","City Council", "City Council (Placebo)"), lty=c("solid","solid","solid","solid"),lwd=c(1.3,1.3,1.3,1.3),col=c("black","black","black","black"),pt.bg=c("white","white","white","white"), pt.cex=1.2, pch=c(19,21,17,24),box.lty=0, box.lwd=1, xpd=TRUE, ncol=2)
dev.off()

